# noinspection PyUnresolvedReferences
import typing
if typing.TYPE_CHECKING:
    from typing import *
    # noinspection PyUnresolvedReferences
    from enum import Enum
    from .vnxtp import *


def set_async_callback_exception_handler(handler: Callable[[Exception, object, str], bool]):
    """
    set a customize exception handler for async callback in this module(pyd)
    \a handler should return True if it handles that exception,
    If the return value of \a handler is not True, exception will be re-thrown.
    """
    ...


class AsyncDispatchException:
    what: str
    instance: object
    function_name: str


class TraderSpi():
    
    
    
    
    def OnDisconnected(self, session_id: int, reason: int)->Any:
        ...
    def OnError(self, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnOrderEvent(self, order_info: XTPOrderInfo, error_info: XTPRspInfoStruct, session_id: int)->Any:
        ...
    def OnTradeEvent(self, trade_info: XTPTradeReport, session_id: int)->Any:
        ...
    def OnCancelOrderError(self, cancel_info: XTPOrderCancelInfo, error_info: XTPRspInfoStruct, session_id: int)->Any:
        ...
    def OnQueryOrder(self, order_info: XTPOrderInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryTrade(self, trade_info: XTPTradeReport, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryPosition(self, position: XTPQueryStkPositionRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryAsset(self, asset: XTPQueryAssetRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryStructuredFund(self, fund_info: XTPStructuredFundInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryFundTransfer(self, fund_transfer_info: XTPFundTransferNotice, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnFundTransfer(self, fund_transfer_info: XTPFundTransferNotice, error_info: XTPRspInfoStruct, session_id: int)->Any:
        ...
    def OnQueryETF(self, etf_info: XTPQueryETFBaseRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryETFBasket(self, etf_component_info: XTPQueryETFComponentRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryIPOInfoList(self, ipo_info: XTPQueryIPOTickerRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryIPOQuotaInfo(self, quota_info: XTPQueryIPOQuotaRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryOptionAuctionInfo(self, option_info: XTPQueryOptionAuctionInfoRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnCreditCashRepay(self, cash_repay_info: XTPCrdCashRepayRsp, error_info: XTPRspInfoStruct, session_id: int)->Any:
        ...
    def OnQueryCreditCashRepayInfo(self, cash_repay_info: XTPCrdCashRepayInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryCreditFundInfo(self, fund_info: XTPCrdFundInfo, error_info: XTPRspInfoStruct, request_id: int, session_id: int)->Any:
        ...
    def OnQueryCreditDebtInfo(self, debt_info: XTPCrdDebtInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryCreditTickerDebtInfo(self, debt_info: XTPCrdDebtStockInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryCreditAssetDebtInfo(self, remain_amount: float, error_info: XTPRspInfoStruct, request_id: int, session_id: int)->Any:
        ...
    def OnQueryCreditTickerAssignInfo(self, assign_info: XTPClientQueryCrdPositionStkInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->Any:
        ...
    def OnQueryCreditExcessStock(self, stock_info: XTPClientQueryCrdSurplusStkRspInfo, error_info: XTPRspInfoStruct, request_id: int, session_id: int)->Any:
        ...
class TraderApi():
    
    
    
    
    @staticmethod
    def CreateTraderApi(client_id: int, save_file_path: str, log_level: XTP_LOG_LEVEL)->XTP.API.TraderApi:
        ...
    def Release(self, )->Any:
        ...
    def GetTradingDay(self, )->str:
        ...
    def RegisterSpi(self, spi: XTP.API.TraderSpi)->Any:
        ...
    def GetApiLastError(self, )->XTPRspInfoStruct:
        ...
    def GetApiVersion(self, )->str:
        ...
    def GetClientIDByXTPID(self, order_xtp_id: int)->int:
        ...
    def GetAccountByXTPID(self, order_xtp_id: int)->str:
        ...
    def SubscribePublicTopic(self, resume_type: XTP_TE_RESUME_TYPE)->Any:
        ...
    def SetSoftwareVersion(self, version: str)->Any:
        ...
    def SetSoftwareKey(self, key: str)->Any:
        ...
    def SetHeartBeatInterval(self, interval: int)->Any:
        ...
    def Login(self, ip: str, port: int, user: str, password: str, sock_type: XTP_PROTOCOL_TYPE)->int:
        ...
    def Logout(self, session_id: int)->int:
        ...
    def InsertOrder(self, order: XTPOrderInsertInfo, session_id: int)->int:
        ...
    def CancelOrder(self, order_xtp_id: int, session_id: int)->int:
        ...
    def QueryOrderByXTPID(self, order_xtp_id: int, session_id: int, request_id: int)->int:
        ...
    def QueryOrders(self, query_param: XTPQueryOrderReq, session_id: int, request_id: int)->int:
        ...
    def QueryTradesByXTPID(self, order_xtp_id: int, session_id: int, request_id: int)->int:
        ...
    def QueryTrades(self, query_param: XTPQueryTraderReq, session_id: int, request_id: int)->int:
        ...
    def QueryPosition(self, ticker: str, session_id: int, request_id: int)->int:
        ...
    def QueryAsset(self, session_id: int, request_id: int)->int:
        ...
    def QueryStructuredFund(self, query_param: XTPQueryStructuredFundInfoReq, session_id: int, request_id: int)->int:
        ...
    def FundTransfer(self, fund_transfer: XTPFundTransferReq, session_id: int)->int:
        ...
    def QueryFundTransfer(self, query_param: XTPQueryFundTransferLogReq, session_id: int, request_id: int)->int:
        ...
    def QueryETF(self, query_param: XTPQueryETFBaseReq, session_id: int, request_id: int)->int:
        ...
    def QueryETFTickerBasket(self, query_param: XTPQueryETFComponentReq, session_id: int, request_id: int)->int:
        ...
    def QueryIPOInfoList(self, session_id: int, request_id: int)->int:
        ...
    def QueryIPOQuotaInfo(self, session_id: int, request_id: int)->int:
        ...
    def QueryOptionAuctionInfo(self, query_param: XTPQueryOptionAuctionInfoReq, session_id: int, request_id: int)->int:
        ...
    def CreditCashRepay(self, amount: float, session_id: int)->int:
        ...
    def QueryCreditCashRepayInfo(self, session_id: int, request_id: int)->int:
        ...
    def QueryCreditFundInfo(self, session_id: int, request_id: int)->int:
        ...
    def QueryCreditDebtInfo(self, session_id: int, request_id: int)->int:
        ...
    def QueryCreditTickerDebtInfo(self, query_param: XTPClientQueryCrdDebtStockReq, session_id: int, request_id: int)->int:
        ...
    def QueryCreditAssetDebtInfo(self, session_id: int, request_id: int)->int:
        ...
    def QueryCreditTickerAssignInfo(self, query_param: XTPClientQueryCrdPositionStockReq, session_id: int, request_id: int)->int:
        ...
    def QueryCreditExcessStock(self, query_param: XTPClientQueryCrdSurplusStkReqInfo, session_id: int, request_id: int)->int:
        ...
class QuoteSpi():
    
    
    
    
    def OnDisconnected(self, reason: int)->Any:
        ...
    def OnError(self, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnSubMarketData(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->Any:
        ...
    def OnUnSubMarketData(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->Any:
        ...
    def OnDepthMarketData(self, market_data: XTPMarketDataStruct, bid1_qty: List[int], bid1_count: int, max_bid1_count: int, ask1_qty: List[int], ask1_count: int, max_ask1_count: int)->Any:
        ...
    def OnSubOrderBook(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->Any:
        ...
    def OnUnSubOrderBook(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->Any:
        ...
    def OnOrderBook(self, order_book: OrderBookStruct)->Any:
        ...
    def OnSubTickByTick(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->Any:
        ...
    def OnUnSubTickByTick(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->Any:
        ...
    def OnTickByTick(self, tbt_data: XTPTickByTickStruct)->Any:
        ...
    def OnSubscribeAllMarketData(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnUnSubscribeAllMarketData(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnSubscribeAllOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnUnSubscribeAllOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnSubscribeAllTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnUnSubscribeAllTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnQueryAllTickers(self, ticker_info: XTPQuoteStaticInfo, error_info: XTPRspInfoStruct, is_last: bool)->Any:
        ...
    def OnQueryTickersPriceInfo(self, ticker_info: XTPTickerPriceInfo, error_info: XTPRspInfoStruct, is_last: bool)->Any:
        ...
    def OnSubscribeAllOptionMarketData(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnUnSubscribeAllOptionMarketData(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnSubscribeAllOptionOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnUnSubscribeAllOptionOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnSubscribeAllOptionTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
    def OnUnSubscribeAllOptionTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->Any:
        ...
class QuoteApi():
    
    
    
    
    @staticmethod
    def CreateQuoteApi(client_id: int, save_file_path: str, log_level: XTP_LOG_LEVEL)->XTP.API.QuoteApi:
        ...
    def Release(self, )->Any:
        ...
    def GetTradingDay(self, )->str:
        ...
    def GetApiVersion(self, )->str:
        ...
    def GetApiLastError(self, )->XTPRspInfoStruct:
        ...
    def SetUDPBufferSize(self, buff_size: int)->Any:
        ...
    def RegisterSpi(self, spi: XTP.API.QuoteSpi)->Any:
        ...
    def SetHeartBeatInterval(self, interval: int)->Any:
        ...
    def SubscribeMarketData(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeMarketData(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeOrderBook(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeOrderBook(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeTickByTick(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeTickByTick(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeAllMarketData(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllMarketData(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeAllOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeAllTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def Login(self, ip: str, port: int, user: str, password: str, sock_type: XTP_PROTOCOL_TYPE)->int:
        ...
    def Logout(self, )->int:
        ...
    def QueryAllTickers(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def QueryTickersPriceInfo(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def QueryAllTickersPriceInfo(self, )->int:
        ...
    def SubscribeAllOptionMarketData(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllOptionMarketData(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeAllOptionOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllOptionOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeAllOptionTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllOptionTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...

